<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>✨ 生日快乐 ✨</title>
    <link href="https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Noto+Sans+SC:wght@300;400;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary-color: #ff69b4;
            --secondary-color: #4a90e2;
            --text-color: #333;
            --background-color: #fef6f9;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Noto Sans SC', sans-serif;
            background: var(--background-color);
            min-height: 100vh;
            overflow-x: hidden;
            perspective: 1000px;
        }

        .stars {
            position: fixed;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 0;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem;
            position: relative;
            z-index: 1;
        }

        .card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 24px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
            padding: 2rem;
            margin: 2rem auto;
            max-width: 800px;
            transform-style: preserve-3d;
            transition: transform 0.6s ease;
        }

        .card:hover {
            transform: translateY(-10px) rotateX(5deg);
        }

        .header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .title {
            font-family: 'Ma Shan Zheng', cursive;
            font-size: 3rem;
            color: var(--primary-color);
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
            animation: float 3s ease-in-out infinite;
        }

        .photo-gallery {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1rem;
            margin: 2rem 0;
        }

        .photo-item {
            position: relative;
            border-radius: 12px;
            overflow: hidden;
            transform-style: preserve-3d;
            transition: transform 0.3s ease;
        }

        .photo-item:hover {
            transform: scale(1.05);
        }

        .photo-item img {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }

        .message {
            font-size: 1.2rem;
            line-height: 1.8;
            color: var(--text-color);
            text-align: center;
            margin: 2rem 0;
            opacity: 0;
            animation: fadeIn 1s ease forwards;
            animation-delay: 0.5s;
        }

        .cake {
            width: 150px;
            height: 150px;
            margin: 2rem auto;
            position: relative;
            cursor: pointer;
        }

        .cake-base {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 60%;
            background: var(--primary-color);
            border-radius: 10px;
        }

        .candle {
            position: absolute;
            top: 20%;
            left: 50%;
            transform: translateX(-50%);
            width: 10px;
            height: 30px;
            background: #fff;
            border-radius: 5px;
        }

        .flame {
            position: absolute;
            top: -20px;
            left: 50%;
            transform: translateX(-50%);
            width: 15px;
            height: 25px;
            background: #ffd700;
            border-radius: 50% 50% 20% 20%;
            animation: flicker 0.5s ease-in-out infinite alternate;
        }

        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes flicker {
            0% { transform: translateX(-50%) scale(1); }
            100% { transform: translateX(-50%) scale(1.1); }
        }

        .wishes {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 1rem;
            margin: 2rem 0;
        }

        .wish {
            background: rgba(255, 255, 255, 0.9);
            padding: 1rem;
            border-radius: 12px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            transform: rotate(var(--rotation));
            animation: appear 0.5s ease forwards;
            opacity: 0;
        }

        @keyframes appear {
            from { opacity: 0; transform: translateY(20px) rotate(var(--rotation)); }
            to { opacity: 1; transform: translateY(0) rotate(var(--rotation)); }
        }

        .music-player {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 100;
            background: rgba(255, 255, 255, 0.9);
            padding: 10px;
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease;
        }

        .music-player:hover {
            transform: scale(1.1);
        }

        @media (max-width: 768px) {
            .title {
                font-size: 2rem;
            }

            .message {
                font-size: 1rem;
            }

            .photo-gallery {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="stars" id="stars"></div>
    
    <div class="container">
        <div class="card">
            <div class="header">
                <h1 class="title">✨ 生日快乐 ✨</h1>
            </div>

            <div class="photo-gallery">
                <!-- 这里可以添加实际的照片 -->
                <div class="photo-item">
                    <img src="https://picsum.photos/400/300?random=1" alt="生日照片">
                </div>
                <div class="photo-item">
                    <img src="https://picsum.photos/400/300?random=2" alt="生日照片">
                </div>
                <div class="photo-item">
                    <img src="https://picsum.photos/400/300?random=3" alt="生日照片">
                </div>
            </div>

            <div class="cake" id="cake">
                <div class="cake-base"></div>
                <div class="candle">
                    <div class="flame" id="flame"></div>
                </div>
            </div>

            <div class="message">
                <p>亲爱的朋友：</p>
                <p>在这特别的日子里，愿你的生命如繁星闪耀，</p>
                <p>愿你的梦想如花儿绽放，</p>
                <p>愿你的每一天都充满欢笑和幸福。</p>
                <p>生日快乐！🎉</p>
            </div>

            <div class="wishes">
                <div class="wish" style="--rotation: -3deg">健康快乐 ❤️</div>
                <div class="wish" style="--rotation: 2deg">梦想成真 🌟</div>
                <div class="wish" style="--rotation: -2deg">幸福永远 🎈</div>
                <div class="wish" style="--rotation: 3deg">前程似锦 ✨</div>
            </div>
        </div>
    </div>

    <div class="music-player" id="musicPlayer">
        🎵
    </div>

    <audio id="bgMusic" loop>
        <source src="assets/birthday-music.mp3" type="audio/mpeg">
    </audio>

    <script>
        // 创建星星背景
        function createStars() {
            const stars = document.getElementById('stars');
            for (let i = 0; i < 200; i++) {
                const star = document.createElement('div');
                star.style.position = 'absolute';
                star.style.width = '2px';
                star.style.height = '2px';
                star.style.background = 'white';
                star.style.left = `${Math.random() * 100}%`;
                star.style.top = `${Math.random() * 100}%`;
                star.style.animation = `twinkle ${Math.random() * 2 + 1}s infinite`;
                stars.appendChild(star);
            }
        }

        // 蜡烛交互
        const cake = document.getElementById('cake');
        const flame = document.getElementById('flame');
        let isBlown = false;

        cake.addEventListener('click', () => {
            if (!isBlown) {
                flame.style.opacity = '0';
                isBlown = true;
                showWish();
            } else {
                flame.style.opacity = '1';
                isBlown = false;
            }
        });

        // 音乐控制
        const musicPlayer = document.getElementById('musicPlayer');
        const bgMusic = document.getElementById('bgMusic');
        let isMusicPlaying = false;

        musicPlayer.addEventListener('click', () => {
            if (isMusicPlaying) {
                bgMusic.pause();
                musicPlayer.textContent = '🎵';
            } else {
                bgMusic.play();
                musicPlayer.textContent = '⏸';
            }
            isMusicPlaying = !isMusicPlaying;
        });

        // 展示生日愿望
        function showWish() {
            const wishes = document.querySelectorAll('.wish');
            wishes.forEach((wish, index) => {
                wish.style.animationDelay = `${index * 0.2}s`;
            });
        }

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', () => {
            createStars();
            showWish();
        });

        // 添加视差效果
        document.addEventListener('mousemove', (e) => {
            const cards = document.querySelectorAll('.card');
            const mouseX = e.clientX / window.innerWidth - 0.5;
            const mouseY = e.clientY / window.innerHeight - 0.5;

            cards.forEach(card => {
                const rotateX = mouseY * 10;
                const rotateY = mouseX * 10;
                card.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
            });
        });
    </script>
</body>
</html>
